package com.pengweiwei.androidzygote.goods;

import androidx.databinding.Bindable;
import androidx.databinding.Observable;
import androidx.databinding.PropertyChangeRegistry;

import com.pengweiwei.androidzygote.BR;

import java.io.Serializable;

/**
 * Created by Donald Peng on 2018/3/28.
 */

public class GoodsBean implements Serializable, Observable {

    /**
     * goods_id : 1
     * cat_id : 12
     * extend_cat_id : 0
     * goods_sn : TP000000
     * goods_name : Apple iPhone 6s Plus 16G 玫瑰金 移动联通电信4G手机
     * click_count : 471
     * brand_id : 11
     * store_count : 299
     * comment_count : 5
     * weight : 150
     * market_price : 6107.00
     * shop_price : 6007.00
     * cost_price : 0.00
     * price_ladder : null
     * keywords : LG 3g 876 支持 双模 2008年04月 灰色 GSM,850,900,1800,1900
     * goods_remark : 选择【联通合约机0元购机】，购机款仅需4066 选择【移动合约机】，锯惠5588，不换号，购机入网返高额话费~ 选【电信合约机】，买手机送话费！激活到账100元，实付低至29元/月，月享4GB大流量
     * original_img : /public/upload/goods/2016/03-09/56e01a4088d3b.jpg
     * is_virtual : 0
     * virtual_indate : 0
     * virtual_limit : 0
     * virtual_refund : 1
     * is_on_sale : 1
     * is_free_shipping : 0
     * on_time : 1477121173
     * sort : 54
     * is_recommend : 1
     * is_new : 1
     * is_hot : 1
     * last_update : 1269589545
     * goods_type : 4
     * spec_type : 4
     * give_integral : 0
     * exchange_integral : 100
     * suppliers_id : 0
     * sales_sum : -73
     * prom_type : 4
     * prom_id : 0
     * commission : 0.00
     * spu :
     * sku :
     * shipping_area_ids :
     */

    private int goods_id;
    private int cat_id;
    private int extend_cat_id;
    private String goods_sn;
    private String goods_name;
    private int click_count;
    private int brand_id;
    private int store_count;
    private int comment_count;
    private int weight;
    private float market_price;
    private float shop_price;
    private float cost_price;
    private Object price_ladder;
    private String keywords;
    private String goods_remark;
    private String original_img;
    private int is_virtual;
    private int virtual_indate;
    private int virtual_limit;
    private int virtual_refund;
    private int is_on_sale;
    private int is_free_shipping;
    private int on_time;
    private int sort;
    private int is_recommend;
    private int is_new;
    private int is_hot;
    private int last_update;
    private int goods_type;
    private int spec_type;
    private int give_integral;
    private int exchange_integral;
    private int suppliers_id;
    private int sales_sum;
    private int prom_type;
    private int prom_id;
    private String commission;
    private String spu;
    private String sku;
    private String shipping_area_ids;
    private transient PropertyChangeRegistry propertyChangeRegistry = new PropertyChangeRegistry();

    @Bindable
    public int getGoods_id() {
        return goods_id;
    }

    public void setGoods_id(int goods_id) {
        this.goods_id = goods_id;
        notifyChange(BR.goods_id);
    }

    @Bindable
    public int getCat_id() {
        return cat_id;
    }

    public void setCat_id(int cat_id) {
        this.cat_id = cat_id;
        notifyChange(BR.cat_id);
    }

    @Bindable
    public int getExtend_cat_id() {
        return extend_cat_id;
    }

    public void setExtend_cat_id(int extend_cat_id) {
        this.extend_cat_id = extend_cat_id;
        notifyChange(BR.extend_cat_id);
    }

    @Bindable
    public String getGoods_sn() {
        return goods_sn;
    }

    public void setGoods_sn(String goods_sn) {
        this.goods_sn = goods_sn;
        notifyChange(BR.goods_sn);
    }

    @Bindable
    public String getGoods_name() {
        return goods_name;
    }

    public void setGoods_name(String goods_name) {
        this.goods_name = goods_name;
        notifyChange(BR.goods_name);
    }

    @Bindable
    public int getClick_count() {
        return click_count;
    }

    public void setClick_count(int click_count) {
        this.click_count = click_count;
        notifyChange(BR.click_count);
    }

    @Bindable
    public int getBrand_id() {
        return brand_id;
    }

    public void setBrand_id(int brand_id) {
        this.brand_id = brand_id;
        notifyChange(BR.brand_id);
    }

    @Bindable
    public int getStore_count() {
        return store_count;
    }

    public void setStore_count(int store_count) {
        this.store_count = store_count;
        notifyChange(BR.store_count);
    }

    @Bindable
    public int getComment_count() {
        return comment_count;
    }

    public void setComment_count(int comment_count) {
        this.comment_count = comment_count;
        notifyChange(BR.comment_count);
    }

    @Bindable
    public int getWeight() {
        return weight;
    }

    public void setWeight(int weight) {
        this.weight = weight;
        notifyChange(BR.weight);
    }

    @Bindable
    public float getMarket_price() {
        return market_price;
    }

    public void setMarket_price(float market_price) {
        this.market_price = market_price;
        notifyChange(BR.market_price);
    }

    @Bindable
    public float getShop_price() {
        return shop_price;
    }

    public void setShop_price(float shop_price) {
        this.shop_price = shop_price;
        notifyChange(BR.shop_price);
    }

    @Bindable
    public float getCost_price() {
        return cost_price;
    }

    public void setCost_price(float cost_price) {
        this.cost_price = cost_price;
        notifyChange(BR.cost_price);
    }

    @Bindable
    public Object getPrice_ladder() {
        return price_ladder;
    }

    public void setPrice_ladder(Object price_ladder) {
        this.price_ladder = price_ladder;
        notifyChange(BR.price_ladder);
    }

    @Bindable
    public String getKeywords() {
        return keywords;
    }

    public void setKeywords(String keywords) {
        this.keywords = keywords;
        notifyChange(BR.keywords);
    }

    @Bindable
    public String getGoods_remark() {
        return goods_remark;
    }

    public void setGoods_remark(String goods_remark) {
        this.goods_remark = goods_remark;
        notifyChange(BR.goods_remark);
    }

    @Bindable
    public String getOriginal_img() {
        return original_img;
    }

    public void setOriginal_img(String original_img) {
        this.original_img = original_img;
        notifyChange(BR.original_img);
    }

    @Bindable
    public int getIs_virtual() {
        return is_virtual;
    }

    public void setIs_virtual(int is_virtual) {
        this.is_virtual = is_virtual;
        notifyChange(BR.is_virtual);
    }

    @Bindable
    public int getVirtual_indate() {
        return virtual_indate;
    }

    public void setVirtual_indate(int virtual_indate) {
        this.virtual_indate = virtual_indate;
        notifyChange(BR.virtual_indate);
    }

    @Bindable
    public int getVirtual_limit() {
        return virtual_limit;
    }

    public void setVirtual_limit(int virtual_limit) {
        this.virtual_limit = virtual_limit;
        notifyChange(BR.virtual_limit);
    }

    @Bindable
    public int getVirtual_refund() {
        return virtual_refund;
    }

    public void setVirtual_refund(int virtual_refund) {
        this.virtual_refund = virtual_refund;
        notifyChange(BR.virtual_refund);
    }

    @Bindable
    public int getIs_on_sale() {
        return is_on_sale;
    }

    public void setIs_on_sale(int is_on_sale) {
        this.is_on_sale = is_on_sale;
        notifyChange(BR.is_on_sale);
    }

    @Bindable
    public int getIs_free_shipping() {
        return is_free_shipping;
    }

    public void setIs_free_shipping(int is_free_shipping) {
        this.is_free_shipping = is_free_shipping;
        notifyChange(BR.is_free_shipping);
    }

    @Bindable
    public int getOn_time() {
        return on_time;
    }

    public void setOn_time(int on_time) {
        this.on_time = on_time;
        notifyChange(BR.on_time);
    }

    @Bindable
    public int getSort() {
        return sort;
    }

    public void setSort(int sort) {
        this.sort = sort;
        notifyChange(BR.sort);
    }

    @Bindable
    public int getIs_recommend() {
        return is_recommend;
    }

    public void setIs_recommend(int is_recommend) {
        this.is_recommend = is_recommend;
        notifyChange(BR.is_recommend);
    }

    @Bindable
    public int getIs_new() {
        return is_new;
    }

    public void setIs_new(int is_new) {
        this.is_new = is_new;
        notifyChange(BR.is_new);
    }

    @Bindable
    public int getIs_hot() {
        return is_hot;
    }

    public void setIs_hot(int is_hot) {
        this.is_hot = is_hot;
        notifyChange(BR.is_hot);
    }

    @Bindable
    public int getLast_update() {
        return last_update;
    }

    public void setLast_update(int last_update) {
        this.last_update = last_update;
        notifyChange(BR.last_update);
    }

    @Bindable
    public int getGoods_type() {
        return goods_type;
    }

    public void setGoods_type(int goods_type) {
        this.goods_type = goods_type;
        notifyChange(BR.goods_type);
    }

    @Bindable
    public int getSpec_type() {
        return spec_type;
    }

    public void setSpec_type(int spec_type) {
        this.spec_type = spec_type;
        notifyChange(BR.spec_type);
    }

    @Bindable
    public int getGive_integral() {
        return give_integral;
    }

    public void setGive_integral(int give_integral) {
        this.give_integral = give_integral;
        notifyChange(BR.give_integral);
    }

    @Bindable
    public int getExchange_integral() {
        return exchange_integral;
    }

    public void setExchange_integral(int exchange_integral) {
        this.exchange_integral = exchange_integral;
        notifyChange(BR.exchange_integral);
    }

    @Bindable
    public int getSuppliers_id() {
        return suppliers_id;
    }

    public void setSuppliers_id(int suppliers_id) {
        this.suppliers_id = suppliers_id;
        notifyChange(BR.suppliers_id);
    }

    @Bindable
    public int getSales_sum() {
        return sales_sum;
    }

    public void setSales_sum(int sales_sum) {
        this.sales_sum = sales_sum;
        notifyChange(BR.sales_sum);
    }

    @Bindable
    public int getProm_type() {
        return prom_type;
    }

    public void setProm_type(int prom_type) {
        this.prom_type = prom_type;
        notifyChange(BR.prom_type);
    }

    @Bindable
    public int getProm_id() {
        return prom_id;
    }

    public void setProm_id(int prom_id) {
        this.prom_id = prom_id;
        notifyChange(BR.prom_id);
    }

    @Bindable
    public String getCommission() {
        return commission;
    }

    public void setCommission(String commission) {
        this.commission = commission;
        notifyChange(BR.commission);
    }

    @Bindable
    public String getSpu() {
        return spu;
    }

    public void setSpu(String spu) {
        this.spu = spu;
        notifyChange(BR.spu);
    }

    @Bindable
    public String getSku() {
        return sku;
    }

    public void setSku(String sku) {
        this.sku = sku;
        notifyChange(BR.sku);
    }

    @Bindable
    public String getShipping_area_ids() {
        return shipping_area_ids;
    }

    public void setShipping_area_ids(String shipping_area_ids) {
        this.shipping_area_ids = shipping_area_ids;
        notifyChange(BR.shipping_area_ids);
    }

    private void notifyChange(int propertyId) {
        if (propertyChangeRegistry == null) {
            propertyChangeRegistry = new PropertyChangeRegistry();
        }
        propertyChangeRegistry.notifyChange(this, propertyId);
    }

    @Override
    public void addOnPropertyChangedCallback(OnPropertyChangedCallback callback) {
        if (propertyChangeRegistry == null) {
            propertyChangeRegistry = new PropertyChangeRegistry();
        }
        propertyChangeRegistry.add(callback);

    }

    @Override
    public void removeOnPropertyChangedCallback(OnPropertyChangedCallback callback) {
        if (propertyChangeRegistry != null) {
            propertyChangeRegistry.remove(callback);
        }
    }

    @Override
    public String toString() {
        return "GoodsBean{" +
                "goods_id=" + goods_id +
                ", cat_id=" + cat_id +
                ", extend_cat_id=" + extend_cat_id +
                ", goods_sn='" + goods_sn + '\'' +
                ", goods_name='" + goods_name + '\'' +
                ", click_count=" + click_count +
                ", brand_id=" + brand_id +
                ", store_count=" + store_count +
                ", comment_count=" + comment_count +
                ", weight=" + weight +
                ", market_price=" + market_price +
                ", shop_price=" + shop_price +
                ", cost_price=" + cost_price +
                ", price_ladder=" + price_ladder +
                ", keywords='" + keywords + '\'' +
                ", goods_remark='" + goods_remark + '\'' +
                ", original_img='" + original_img + '\'' +
                ", is_virtual=" + is_virtual +
                ", virtual_indate=" + virtual_indate +
                ", virtual_limit=" + virtual_limit +
                ", virtual_refund=" + virtual_refund +
                ", is_on_sale=" + is_on_sale +
                ", is_free_shipping=" + is_free_shipping +
                ", on_time=" + on_time +
                ", sort=" + sort +
                ", is_recommend=" + is_recommend +
                ", is_new=" + is_new +
                ", is_hot=" + is_hot +
                ", last_update=" + last_update +
                ", goods_type=" + goods_type +
                ", spec_type=" + spec_type +
                ", give_integral=" + give_integral +
                ", exchange_integral=" + exchange_integral +
                ", suppliers_id=" + suppliers_id +
                ", sales_sum=" + sales_sum +
                ", prom_type=" + prom_type +
                ", prom_id=" + prom_id +
                ", commission='" + commission + '\'' +
                ", spu='" + spu + '\'' +
                ", sku='" + sku + '\'' +
                ", shipping_area_ids='" + shipping_area_ids + '\'' +
                ", propertyChangeRegistry=" + propertyChangeRegistry +
                '}';
    }
}
